﻿'========================================================================
'功能:入網型態商業邏輯物件
'作者:andy
'日期: 2011/3/1
'========================================================================

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Text
Imports System.Data
Namespace Telecom.BBL
    Public Class NetWorkTypeBBL

        ''' <summary>
        ''' 取得某一廠的入網型態
        ''' </summary>
        ''' <returns>取得某一廠的入網型態</returns>
        ''' <remarks>取得某一廠的入網型態</remarks>
        Public Function GetNetworkType(ByVal network_site As String, ByVal Kind As String, ByVal dbName As String) As DataTable
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            If Kind = "" Then
                Return db1.GetNetworkType(network_site)
            Else
                Return db1.GetNetworkTypeInsert(network_site)
            End If


        End Function

        Public Function GetTypeNetworkTypeByApplyType(ByVal network_site As String, ByVal type_code As String, ByVal dbName As String) As DataTable
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)

            Return db1.GetTypeNetworkTypeByApplyType(network_site, type_code)
           
        End Function

        ''' <summary>
        ''' 新增入網型態資料
        ''' </summary>
        ''' <remarks>新增入網型態資料</remarks>
        Public Sub UpdateNetworkType(ByVal canModi As Boolean, ByVal network_no As String, ByVal network_name As String, ByVal network_site As String, ByVal network_desc As String, ByVal NeedApprove As Integer, ByVal UID As String, ByVal ChkOA As Boolean, ByVal dbName As String, ByVal Message As String, ByVal FirstPay As Boolean)
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            If canModi Then
                db1.InsertNetworkType(network_no, network_name, network_site, network_desc, NeedApprove, UID, ChkOA, Message, FirstPay)
            Else
                db1.UpdateNetworkType(network_no, network_name, network_site, network_desc, NeedApprove, UID, ChkOA, Message, FirstPay)
            End If

        End Sub
        ''' <summary>
        ''' 檢查入網型態是否存在
        ''' </summary>
        ''' <returns>檢查入網型態是否存在</returns>
        ''' <remarks>檢查入網型態是否存在</remarks>
        Public Function network_noIsExist(ByVal network_no As String, ByVal network_site As String, ByVal dbName As String) As Boolean
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            Return db1.network_noIsExist(network_no, network_site)
        End Function

        Public Function GetTypeNetworkType(ByVal network_site As String, ByVal network_no As String, ByVal Kind As String, ByVal dbName As String) As DataTable

            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            If Kind = "" Then
                Return db1.GetTypeNetworkType(network_site, network_no)
            Else
                Return db1.GetTypeNetworkTypeInsert(network_site, network_no)
            End If

        End Function

        Public Sub TypeNetworkTypeInsert(ByVal network_site As String, ByVal network_no As String, ByVal type_code As String, ByVal UID As String, ByVal dbName As String)
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            db1.TypeNetworkTypeInsert(network_site, network_no, type_code, UID)
        End Sub
        Public Function TelTypenetwork_noIsExist(ByVal network_no As String, ByVal network_site As String, ByVal type_code As String, ByVal dbName As String) As Boolean
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            Return db1.TelTypenetwork_noIsExist(network_no, network_site, type_code)
        End Function

        Public Sub DeleteTypenetwork_no(ByVal network_no As String, ByVal network_site As String, ByVal type_code As String, ByVal dbName As String)
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            db1.DeleteTypenetwork_no(network_no, network_site, type_code)
        End Sub

        Public Function GetDataBynetwork_no(ByVal network_no As String, ByVal network_site As String, ByVal dbName As String) As DataTable
            Dim db1 As Telecom.DAO.NetworkTypeDAO = New Telecom.DAO.NetworkTypeDAO(dbName)
            Return db1.GetDataBynetwork_no(network_no, network_site)
        End Function
    End Class
End Namespace

